package com.elysia.adminservice.controller;

import com.elysia.adminservice.domain.dto.GameStatisticDTO;
import com.elysia.adminservice.domain.vo.GameStatisticVO;
import com.elysia.adminservice.feign.NewsFeignClient;
import com.elysia.adminservice.result.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/game-statistic")
@RequiredArgsConstructor
@Slf4j
public class GameStatisticController {
    private final NewsFeignClient newsFeignClient;
    @GetMapping(value = "/all")
    public Result<List<GameStatisticVO>> getAllUpdateLog() {
        log.info("获取全部统计项");
        return newsFeignClient.getAllGameStatistics();
    }
    @PostMapping
    public Result<List<GameStatisticVO>> addNewGameStatistic(@RequestBody GameStatisticDTO gameStatisticDTO) {
        log.info("添加统计项{}", gameStatisticDTO);
        return newsFeignClient.addGameStatistic(gameStatisticDTO);
    }
    @PutMapping
    public Result<List<GameStatisticVO>> updateGameStatistic(@RequestBody GameStatisticDTO gameStatisticDTO) {
        log.info("更新统计项{}", gameStatisticDTO);
        return newsFeignClient.updateGameStatistic(gameStatisticDTO);
    }
}
